﻿using HZU.ZP.Data.Interfaces.Resume;
using HZU.ZP.Domain.IService.Resume;
using HZU.ZP.Domain.Model.Resume;
using HZU.ZP.Domain.ServiceImpl.Mappers.Resume;
using System;
using System.Collections.Generic;
using System.Text;

namespace HZU.ZP.Domain.ServiceImpl.PCSvc.Resume
{
    public class EducationExperienceService:IEducationExperienceService
    {
        private EducationExperienceMapper _mapper = new EducationExperienceMapper();
        private IEducationExperienceDao _sqlData;
        public EducationExperienceService(IEducationExperienceDao sqlData)
        {
            _sqlData = sqlData;
        }

        public bool AddEducationExperience(EducationExperience educationExperience)
        {
            var eduExpDao = _mapper.MapToDao(educationExperience);
            _sqlData.AddEducationExperience(eduExpDao);
            return true;
        }

        public bool DeleteEducationExperience(int id)
        {
            _sqlData.DeleteEducationExperience(id);
            return true;
        }

        public IList<EducationExperience> GetEducationExperienceList(int applicanId)
        {
            return _mapper.MapToDomainList(_sqlData.GetEducationExperienceList(applicanId));
        }

        public bool UpdateEducationExperience(EducationExperience educationExperience)
        {
            var eduExpDao = _mapper.MapToDao(educationExperience);
            _sqlData.UpdateEducationExperience(eduExpDao);
            return true;
        }
    }
}
